/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.restaurant.domain;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author root
 */
@Entity
@Table(name = "sidedishmenu")
@XmlRootElement(name = "sidedishmenu")
@NamedQueries({
    @NamedQuery(name = "Sidedishmenu.findAll", query = "SELECT s FROM Sidedishmenu s"),
    @NamedQuery(name = "Sidedishmenu.findBySidedishmenuID", query = "SELECT s FROM Sidedishmenu s WHERE s.sidedishmenuPK.sidedishmenuID = :sidedishmenuID"),
    @NamedQuery(name = "Sidedishmenu.findByDescription", query = "SELECT s FROM Sidedishmenu s WHERE s.description = :description"),
    @NamedQuery(name = "Sidedishmenu.findByMenuMenuID", query = "SELECT s FROM Sidedishmenu s WHERE s.sidedishmenuPK.menuMenuID = :menuMenuID"),
    @NamedQuery(name = "Sidedishmenu.findByMenuMenuIDSidedishID", query = "SELECT s FROM Sidedishmenu s WHERE s.sidedishmenuPK.menuMenuIDSidedishID = :menuMenuIDSidedishID")})
public class Sidedishmenu implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SidedishmenuPK sidedishmenuPK;
    @Column(name = "description")
    private String description;
    @JoinColumn(name = "menu_MenuID_SidedishID", referencedColumnName = "MenuID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Menu menu;
    @JoinColumn(name = "menu_MenuID", referencedColumnName = "MenuID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Menu menu1;

    public Sidedishmenu() {
    }

    public Sidedishmenu(SidedishmenuPK sidedishmenuPK) {
        this.sidedishmenuPK = sidedishmenuPK;
    }

    public Sidedishmenu(long sidedishmenuID, long menuMenuID, long menuMenuIDSidedishID) {
        this.sidedishmenuPK = new SidedishmenuPK(sidedishmenuID, menuMenuID, menuMenuIDSidedishID);
    }

    public SidedishmenuPK getSidedishmenuPK() {
        return sidedishmenuPK;
    }

    public void setSidedishmenuPK(SidedishmenuPK sidedishmenuPK) {
        this.sidedishmenuPK = sidedishmenuPK;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Menu getMenu() {
        return menu;
    }

    public void setMenu(Menu menu) {
        this.menu = menu;
    }

    public Menu getMenu1() {
        return menu1;
    }

    public void setMenu1(Menu menu1) {
        this.menu1 = menu1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sidedishmenuPK != null ? sidedishmenuPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sidedishmenu)) {
            return false;
        }
        Sidedishmenu other = (Sidedishmenu) object;
        if ((this.sidedishmenuPK == null && other.sidedishmenuPK != null) || (this.sidedishmenuPK != null && !this.sidedishmenuPK.equals(other.sidedishmenuPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.restaurant.domain.Sidedishmenu[sidedishmenuPK=" + sidedishmenuPK + "]";
    }

}
